home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / dspice0s / setup.c < prev    next >
C/C++ Source or Header  |  1992-11-21  |  8KB  |  268 lines

  1. /* setup.f -- translated by f2c (version of 3 February 1990  3:36:42).
  2.    You must link the resulting object file with the libraries:
  3.     -lF77 -lI77 -lm -lc   (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /* Common Block Declarations */
  9.  
  10. struct {
  11.     integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
  12.         nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
  13.         junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
  14.         numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
  15.         iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
  16.         lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
  17.         nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
  18.         irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
  19.         lvntmp;
  20. } tabinf_;
  21.  
  22. #define tabinf_1 tabinf_
  23.  
  24. struct {
  25.     integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt, 
  26.         nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
  27. } cirdat_;
  28.  
  29. #define cirdat_1 cirdat_
  30.  
  31. struct {
  32.     doublereal atime, aprog[3], adate, atitle[10], defl, defw, defad, defas, 
  33.         rstats[50];
  34.     integer iwidth, lwidth, nopage;
  35. } miscel_;
  36.  
  37. #define miscel_1 miscel_
  38.  
  39. struct {
  40.     integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod, 
  41.         lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
  42. } flags_;
  43.  
  44. #define flags_1 flags_
  45.  
  46. struct {
  47.     doublereal tcstar[2], tcstop[2], tcincr[2];
  48.     integer icvflg, itcelm[2], kssop, kinel, kidin, kovar, kidout;
  49. } dc_;
  50.  
  51. #define dc_1 dc_
  52.  
  53. struct {
  54.     doublereal fstart, fstop, fincr, skw2, refprl, spw2;
  55.     integer jacflg, idfreq, inoise, nosprt, nosout, nosin, idist, idprt;
  56. } ac_;
  57.  
  58. #define ac_1 ac_
  59.  
  60. struct {
  61.     doublereal value[200000];
  62. } blank_;
  63.  
  64. #define blank_1 blank_
  65.  
  66. /* spice version 2g.6  sccsid=setup.ma 3/15/83 */
  67. /*<       subroutine setup >*/
  68. /* Subroutine */ int setup_()
  69. {
  70.     /* System generated locals */
  71.     integer i_1;
  72.  
  73.     /* Local variables */
  74.     static integer node;
  75.     extern /* Subroutine */ int getm4_();
  76.     static integer i;
  77.     static doublereal t1;
  78.     extern integer indxx_();
  79.     static doublereal t2;
  80. #define nodplc ((integer *)&blank_1)
  81. #define cvalue ((complex *)&blank_1)
  82.     extern logical memptr_();
  83.     extern /* Subroutine */ int second_(), clrmem_(), matptr_(), reordr_(), 
  84.         matloc_(), sizmem_();
  85.     static integer nic, loc;
  86.  
  87. /*<       implicit double precision (a-h,o-z) >*/
  88.  
  89. /*     this routine drives the sparse matrix setup used by spice. */
  90.  
  91. /* spice version 2g.6  sccsid=tabinf 3/15/83 */
  92. /*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
  93. /*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
  94. /*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
  95. /*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
  96. /*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
  97. /*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
  98. /*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
  99. /*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
  100. /* spice version 2g.6  sccsid=cirdat 3/15/83 */
  101. /*<       common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
  102. /*<      1   nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
  103. /* spice version 2g.6  sccsid=miscel 3/15/83 */
  104. /*<       common /miscel/ atime,aprog(3),adate,atitle(10),defl,defw,defad, >*/
  105. /*<      1  defas,rstats(50),iwidth,lwidth,nopage >*/
  106. /* spice version 2g.6  sccsid=flags 3/15/83 */
  107. /*<       common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
  108. /*<      1   lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
  109. /* spice version 2g.6  sccsid=dc 3/15/83 */
  110. /*<       common /dc/ tcstar(2),tcstop(2),tcincr(2),icvflg,itcelm(2),kssop, >*/
  111. /*<      1   kinel,kidin,kovar,kidout >*/
  112. /* spice version 2g.6  sccsid=ac 3/15/83 */
  113. /*<       common /ac/ fstart,fstop,fincr,skw2,refprl,spw2,jacflg,idfreq, >*/
  114. /*<      1   inoise,nosprt,nosout,nosin,idist,idprt >*/
  115. /* spice version 2g.6  sccsid=blank 3/15/83 */
  116. /*<       common /blank/ value(200000) >*/
  117. /*<       integer nodplc(64) >*/
  118. /*<       complex cvalue(32) >*/
  119. /*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/
  120.  
  121. /*<       logical memptr >*/
  122.  
  123. /*<       call second(t1) >*/
  124.     second_(&t1);
  125. /*<       nstop=numnod+jelcnt(3)+jelcnt(6)+jelcnt(8)+jelcnt(9)+2*jelcnt(17) >*/
  126.     cirdat_1.nstop = cirdat_1.numnod + cirdat_1.jelcnt[2] + cirdat_1.jelcnt[5]
  127.          + cirdat_1.jelcnt[7] + cirdat_1.jelcnt[8] + (cirdat_1.jelcnt[16] 
  128.         << 1);
  129.  
  130. /*     clear old tables */
  131.  
  132. /*<       if (memptr(irpt)) call clrmem(irpt) >*/
  133.     if (memptr_(&tabinf_1.irpt)) {
  134.     clrmem_(&tabinf_1.irpt);
  135.     }
  136. /*<       if (memptr(jcpt)) call clrmem(jcpt) >*/
  137.     if (memptr_(&tabinf_1.jcpt)) {
  138.     clrmem_(&tabinf_1.jcpt);
  139.     }
  140. /*<       if (memptr(irowno)) call clrmem(irowno) >*/
  141.     if (memptr_(&tabinf_1.irowno)) {
  142.     clrmem_(&tabinf_1.irowno);
  143.     }
  144. /*<       if (memptr(jcolno)) call clrmem(jcolno) >*/
  145.     if (memptr_(&tabinf_1.jcolno)) {
  146.     clrmem_(&tabinf_1.jcolno);
  147.     }
  148.  
  149. /*  reserve matrix locations for each element */
  150.  
  151. /*<       call matptr >*/
  152.     matptr_();
  153. /*<       if (nogo.ne.0) go to 1000 >*/
  154.     if (flags_1.nogo != 0) {
  155.     goto L1000;
  156.     }
  157.  
  158. /*  reorder matrix pointers */
  159.  
  160. /*<       nttbr=0 >*/
  161.     tabinf_1.nttbr = 0;
  162. /*<       do 120 i=2,nstop >*/
  163.     i_1 = cirdat_1.nstop;
  164.     for (i = 2; i <= i_1; ++i) {
  165. /*<       loc=i >*/
  166.     loc = i;
  167. /*<   110 if (nodplc(jcpt+loc).eq.0) go to 120 >*/
  168. L110:
  169.     if (nodplc[tabinf_1.jcpt + loc - 1] == 0) {
  170.         goto L120;
  171.     }
  172. /*<       loc=nodplc(jcpt+loc) >*/
  173.     loc = nodplc[tabinf_1.jcpt + loc - 1];
  174. /*<       nttbr=nttbr+1 >*/
  175.     ++tabinf_1.nttbr;
  176. /*<       go to 110 >*/
  177.     goto L110;
  178. /*<   120 continue >*/
  179. L120:
  180.     ;}
  181. /* ...  add ground */
  182. /*<       nttar=nttbr >*/
  183.     tabinf_1.nttar = tabinf_1.nttbr;
  184. /*<       call reordr >*/
  185.     reordr_();
  186. /*<       if (nogo.ne.0) go to 1000 >*/
  187.     if (flags_1.nogo != 0) {
  188.     goto L1000;
  189.     }
  190.  
  191. /*  store matrix locations */
  192.  
  193. /*<       call matloc >*/
  194.     matloc_();
  195.  
  196. /*  .nodeset */
  197.  
  198. /*<   200 call sizmem(nsnod,nic) >*/
  199. /* L200: */
  200.     sizmem_(&tabinf_1.nsnod, &nic);
  201. /*<       if(nic.eq.0) go to 220 >*/
  202.     if (nic == 0) {
  203.     goto L220;
  204.     }
  205. /*<       call getm4(nsmat,nic) >*/
  206.     getm4_(&tabinf_1.nsmat, &nic);
  207. /*<       do 210 i=1,nic >*/
  208.     i_1 = nic;
  209.     for (i = 1; i <= i_1; ++i) {
  210. /*<       node=nodplc(nsnod+i) >*/
  211.     node = nodplc[tabinf_1.nsnod + i - 1];
  212. /*<       nodplc(nsmat+i)=indxx(node,node) >*/
  213.     nodplc[tabinf_1.nsmat + i - 1] = indxx_(&node, &node);
  214. /*<   210 continue >*/
  215. /* L210: */
  216.     }
  217.  
  218. /*  transient initial conditions */
  219.  
  220. /*<   220 call sizmem(icnod,nic) >*/
  221. L220:
  222.     sizmem_(&tabinf_1.icnod, &nic);
  223. /*<       if(nic.eq.0) go to 300 >*/
  224.     if (nic == 0) {
  225.     goto L300;
  226.     }
  227. /*<       call getm4(icmat,nic) >*/
  228.     getm4_(&tabinf_1.icmat, &nic);
  229. /*<       do 230 i=1,nic >*/
  230.     i_1 = nic;
  231.     for (i = 1; i <= i_1; ++i) {
  232. /*<       node=nodplc(icnod+i) >*/
  233.     node = nodplc[tabinf_1.icnod + i - 1];
  234. /*<       nodplc(icmat+i)=indxx(node,node) >*/
  235.     nodplc[tabinf_1.icmat + i - 1] = indxx_(&node, &node);
  236. /*<   230 continue >*/
  237. /* L230: */
  238.     }
  239.  
  240. /*<   300 call clrmem(iseq) >*/
  241. L300:
  242.     clrmem_(&tabinf_1.iseq);
  243. /*<       call clrmem(iseq1) >*/
  244.     clrmem_(&tabinf_1.iseq1);
  245. /*<       call clrmem(neqn) >*/
  246.     clrmem_(&tabinf_1.neqn);
  247. /*<       call clrmem(nodevs) >*/
  248.     clrmem_(&tabinf_1.nodevs);
  249. /*<       call clrmem(ndiag) >*/
  250.     clrmem_(&tabinf_1.ndiag);
  251.  
  252. /*  finished */
  253.  
  254. /*<  1000 call second(t2) >*/
  255. L1000:
  256.     second_(&t2);
  257. /*<       rstats(2)=rstats(2)+t2-t1 >*/
  258.     miscel_1.rstats[1] = miscel_1.rstats[1] + t2 - t1;
  259. /*<       return >*/
  260.     return 0;
  261. /*<       end >*/
  262. } /* setup_ */
  263.  
  264. #undef cvalue
  265. #undef nodplc
  266.  
  267.  
  268.